home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 4
/
Apprentice-Release4.iso
/
Source Code
/
Libraries
/
PNL Libraries
/
MyEmergencyNotifier.p
< prev
next >
Wrap
Text File
|
1995-10-22
|
1KB
|
57 lines
unit MyEmergencyNotifier;
interface
uses
Types;
procedure EmergencyNotify (s: Str255);
implementation
uses
Memory, Notification, MyVersionResource;
const
T_NMInstall = $A05E;
T_Unimplemented = $A89F;
type
NMRecPtrPtr = ^NMRecPtr;
procedure EmergencyNotify (s: Str255);
var
oe: OSErr;
note: NMRecPtr;
vers: versionRecord;
begin
GetVersion(vers);
s := concat(vers.name,': ',s);
if NGetTrapAddress(T_NMInstall, OSTrap) = NGetTrapAddress(T_Unimplemented, ToolTrap) then begin
SysBeep(1); { Best we can do I guess. Could put up the dialog box maybe?...}
end
else begin
note := NMRecPtr(NewPtrSys(sizeof(NMRec)));
if note = nil then begin
SysBeep(1); { Can't do much else if there isnt even room for this! }
end
else begin
with note^ do begin
qType := nmType;
nmMark := 0;
nmStr := StringPtr(NewPtrSys(length(s) + 1));
BlockMoveData(@s, ptr(nmStr), length(s) + 1);
nmIcon := nil;
nmSound := nil;
nmResp := nil;
end;
oe := NMInstall(note);
if oe <> noErr then begin
SysBeep(1);
end;
end;
end;
end;
end.